<?
@session_start();
require_once("conn.php");
if($_SESSION["ids"] != "" && $_SESSION["usernames"] != ""){
	//echo "<script>location.href='index.php';</script>";
}else{
	echo "<script>location.href='login.php';</script>";
	//echo "asdasd";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"[]>
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Purchase System</title>
    <link rel="stylesheet" href="style.css" type="text/css" media="screen" />
    <!--[if IE 6]><link rel="stylesheet" href="style.ie6.css" type="text/css" media="screen" /><![endif]-->
    <!--[if IE 7]><link rel="stylesheet" href="style.ie7.css" type="text/css" media="screen" /><![endif]-->
    <script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script>
	<script type="text/javascript" src="scripts/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="scripts/jquery-ui-1.8.7.custom.min.js"></script>
	<script type="text/javascript" src="scripts/purchase.js"></script>
	<script type="text/javascript" src="scripts/jquery.autocomplete.js"></script>
	<link rel="stylesheet" href="css/jquery.autocomplete.css" type="text/css" />
	<link rel="stylesheet" type="text/css" href="tables.css"/>
	<link rel="stylesheet" type="text/css" href="stylesheets/flick/jquery-ui-1.8.7.custom.css" />
	<style type="text/css">
		
		.art-post .layout-item-0 { padding-right: 10px;padding-left: 10px; }
		.ie7 .art-post .art-layout-cell {border:none !important; padding:0 !important; }
		.ie6 .art-post .art-layout-cell {border:none !important; padding:0 !important; }

		.images{
			border:0px;
		}	
		.center{
			width:200px;
		}
		li{
			list-style-type:none;
		}

		.table_{
			/*width:900px;*/
		}

		.required{
			color:red;
			padding-left:10px;
			font-weight:bold;
		}
		.input_require{
			background-color: #FFFF99; 
		}
		#or_list{
			border:1px solid #ccc;
			border-collapse:collapse;
			display:none;
		}
		#main_panel{
			border: 1px solid #ccc;
			min-height:400px;
			padding:5px;
		}

		.aQ{
			text-align:left;
			color:red;
			font-weight:bold;
		}
		.a{
			text-align:left;
		}
		.b{
			text-align:center;
		}
		.c{
			text-align:center;
		}
		
	</style>	
</head>
<body>
<?
	$sql = "SELECT id,datediff(now(),receive_date) as datecheck ,product_name,date(send_date) as send_date,send_place,bill_no,date(receive_date) as receive_date,send_by,accept,create_date FROM pch_repair_item WHERE accept <> 'D' ORDER BY receive_date;";
	//echo $sql;
	$query = mysql_query($sql);
	while($row = mysql_fetch_array($query)){
		if($row["accept"] == 'N' || $row["accept"] == ''){
			if($row["datecheck"] == 0){
				echo "<script type=\"text/javascript\">var repairid=".$row["id"].";alert('รายการของส่งซ่อมหมายเลข '+repairid+' ถึงกำหนดรับแล้ว') </script>";
			}else if($row["datecheck"] > 0){
				echo "<script type=\"text/javascript\">var repairid=".$row["id"].";alert('รายการของส่งซ่อมหมายเลข '+repairid+' เลยกำหนดรับแล้ว ".$row["datecheck"]." วัน') </script>";
			}
		}
	}
?>
<div id="art-main">
    <div class="cleared reset-box"></div>
    <div class="art-header">
        <div class="art-header-position">
            <div class="art-header-wrapper">
                <div class="cleared reset-box"></div>
                <div class="art-header-inner">
                <div class="art-headerobject"></div>
                <div class="art-logo">
					<h1 class="art-logo-name">Purchase System</h1>
                </div>
            </div>
        </div>
    </div>
    </div>
    <div class="cleared reset-box"></div>
    <div class="art-box art-sheet">
        <div class="art-box-body art-sheet-body">
            <div class="art-layout-wrapper">
                <div class="art-content-layout">
                    <div class="art-content-layout-row">
                        <div class="art-layout-cell art-sidebar1">
						<div class="art-box art-vmenublock">
							<div class="art-box-body art-vmenublock-body">
								<div class="art-bar art-vmenublockheader">
									<span style="font-weight:bold;">Welcome </span><?=$_SESSION["usernames"];?>
								</div>
								<?include("menu.php");?>
								<div class="cleared"></div>
							</div>
						</div>
                        <div class="cleared"></div>
                        </div>
                        <div class="art-layout-cell art-content">
							<div class="art-box art-post">
								<div class="art-box-body art-post-body">
									<div class="art-post-inner art-article">
										<div class="art-postcontent">
											<div class="art-content-layout">
												<div id="main_panel">
													<div>
													<div style="font-weight:bold;color:blue;padding:5px;"><a href="zawgyi.exe">Download Font Myanmar</a></div>
															<div><?
																//$sql = "SELECT * FROM pch_changelog ORDER BY id desc limit 0,3;";
																//$query = mysql_query($sql);
																//while($row = mysql_fetch_array($query)){
																?>
																<!--	<div><span style="padding:5px;"><?=$row["update"]?></span><span><?=$row["desciption"]?></span></div>-->
																<?
																//}
															?></div>
														<table width="100%" style="border-style:none;">
															<tr>
																<td align="center" style="vertical-align:middle;height:400px;">
																	<div align="center"><a href="language.php?lang=th"><img src="images/thai.png" border="1" height="100"></a></div>
																</td>
																<td align="center" style="vertical-align:middle;height:400px;">
																	<div align="center"><a href="language.php?lang=mm"><img src="images/myanmar.jpg" border="1" height="100"></a></div>
																</td>
															</tr>															
														</table>
														
													</div>
												</div>
											</div>
										</div>
										<div class="cleared"></div>
									</div>
									<div class="cleared"></div>
								</div>
							</div>
							<div class="cleared"></div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="cleared"></div>
    		<div class="cleared"></div>
        </div>
    </div>
    <div class="art-footer">
        <div class="art-footer-body">
            <div class="art-footer-center">
                <div class="art-footer-wrapper">
                    <div class="art-footer-text">
						<p>Copyright © 2012. All Rights Reserved. Banraya Resort & Spa</p>
                        <div class="cleared"></div>
                    </div>
                </div>
            </div>
            <div class="cleared"></div>
        </div>
    </div>
    <div class="cleared"></div>
</div>
<div id="addCart" style="display:none;"></div>
</body>
</html>